<?php

$memcache = new Memcache;
$memcache->connect('127.0.0.1', 11211) or die ("Could not connect");
//$version = $memcache->getVersion();
echo "Server's version: ".$version."\n";


$ret = $memcache->set('key', "hello,world!", false, 0);
var_dump($ret);
$ret = $memcache->set('key2', "hello,world3!", false, 0);
var_dump($ret);
//echo "Store data in the cache (data will expire in 10 seconds)\n";

for($i = 0; $i < 10; $i++)
{
usleep(98000);
$get_result = $memcache->get('key');
echo "Data from the cache:\n";
var_dump($get_result);
}

?>
